package bp.App.Demo;
import bp.da.DBAccess;
import bp.da.DataTable;
import bp.difference.handler.DirectoryPageBase;
public class Handler_Demo extends DirectoryPageBase {


    /// <summary>
    /// 生成版本号.
    /// </summary>
    /// <returns></returns>
    public String ZhiBiaoFXFF_GenerVer() throws Exception {
        String no = this.GetRequestVal("No");
        ZhiBiaoFXFF en = new ZhiBiaoFXFF(no);

        int maxVer = DBAccess.RunSQLReturnValInt("SELECT count(*) FROM Demo_ZhiBiaoFXFF  WHERE Mark='" + en.getMark() + "' ") + 1;

        //生成新的编号.
        en.setNo(en.getMark() + "_" + maxVer); // en.GenerNewNo;
        en.SetValByKey("EnVer", maxVer);
        en.SetValByKey("EnSta", 2); //设置为不可用.
        en.Insert();

        return String.valueOf(maxVer);

        // return "版本生成成功,编号:" + en.No + " 版本号:" + maxVer;
    }
    public String ZhiBiaoFXFF_SetMainVer() throws Exception {
        String no = this.GetRequestVal("No");
        ZhiBiaoFXFF en = new ZhiBiaoFXFF(no);

        DBAccess.RunSQL("UPDATE Demo_ZhiBiaoFXFF SET EnSta=1 WHERE EnSta=0 AND Mark='" + en.getMark() + "'");

        en.SetValByKey("EnSta", 0); //S设置为可用..
        en.Update();

        return "info@执行成功,请刷新.";
    }
    /// <summary>
    /// 注销学籍
    /// </summary>
    /// <returns></returns>
    public String Student_ZhuXiaoXueJi()
    {
        String name = this.GetRequestVal("Name");
        String stuNo = this.GetRequestVal("No");
        //DBAccess.RunSQL("xxxx");
        return "注销成功:" + stuNo + " Name:" + name;
    }
    /// <summary>
    /// 缴纳班费
    /// </summary>
    /// <returns></returns>
    public String Student_JiaoNaXueFei()
    {
        String name = this.GetRequestVal("Name");
        String stuNo = this.GetRequestVal("No");
        return "缴纳成功:" + stuNo + " Name:" + name;
    }

    /// <summary>
    /// 获得班级列表
    /// </summary>
    /// <returns></returns>
    public String Student_GenerBanJis()
    {
        String sql = "SELECT No,Name FROM Demo_BanJi WHERE 1=1";
        DataTable dt = DBAccess.RunSQLReturnTable(sql);
        dt.Columns.get(0).ColumnName = "No";
        dt.Columns.get(1).ColumnName = "Name";
        return bp.tools.Json.ToJson(dt);
    }

}
